box: Fix RTL styling
authorBenjamin Otte <otte@redhat.com>
Tue, 12 May 2015 16:27:19 +0000 (18:27 +0200)
committerBenjamin Otte <otte@redhat.com>
Tue, 12 May 2015 16:44:59 +0000 (18:44 +0200)
gtk/gtkbox.c

index 3a2fb5ac35489a07419d6960a4f03f96fd0f28e9..53a52a28030351073064b226a8ff94aa97008808 100644 (file)
@@ -1447,12 +1447,29 @@ gtk_box_invalidate_order_foreach (GtkWidget *widget,
   *previous = cur;
 }
 
+static void
+gtk_box_invalidate_order_foreach_reverse (GtkWidget *widget,
+                                          gpointer   prev)
+{
+  GtkCssNode **previous = prev;
+  GtkCssNode *cur = gtk_widget_get_css_node (widget);
+
+  if (*previous)
+    gtk_css_node_set_before (cur, *previous);
+
+  *previous = cur;
+}
+
 static void
 gtk_box_invalidate_order (GtkBox *box)
 {
   GtkCssNode *previous = NULL;
+
   gtk_container_foreach (GTK_CONTAINER (box),
-                         gtk_box_invalidate_order_foreach,
+                         (box->priv->orientation == GTK_ORIENTATION_HORIZONTAL
+                          && gtk_widget_get_direction (GTK_WIDGET (box)) == GTK_TEXT_DIR_RTL)
+                         ? gtk_box_invalidate_order_foreach_reverse
+                         : gtk_box_invalidate_order_foreach,
                          &previous);
 }